#ifndef AVALON_JSONSERIALIZER_HPP
#define AVALON_JSONSERIALIZER_HPP
#include <deque>
#include <boost/tuple/tuple.hpp>
#include "Avalon/IO/Buffer.hpp"
#include "Avalon/Serialization/Serializer.hpp"

namespace Avalon {
namespace Serialization {

  /*! \class JsonSerializer
   *  \brief Implements the Serializer using JSON.
   *  \author Kamal Mansouri <kranar@hotmail.com>
   */
  class JsonSerializer : public Serializer {
    public:

      //! Constructs a JsonSerializer.
      /*!
        \param prettyPrint <code>true</code> iff the data should be serialized
                           in a human readable format.
      */
      JsonSerializer(bool prettyPrint);

      virtual ~JsonSerializer();

      virtual IO::Buffer GetSerializedData();

      virtual void Shuttle(const char* name, bool& value);

      virtual void Shuttle(const char* name, char& value);

      virtual void Shuttle(const char* name, unsigned char& value);

      virtual void Shuttle(const char* name, short& value);

      virtual void Shuttle(const char* name, unsigned short& value);

      virtual void Shuttle(const char* name, int& value);

      virtual void Shuttle(const char* name, unsigned int& value);

      virtual void Shuttle(const char* name, long& value);

      virtual void Shuttle(const char* name, unsigned long& value);

      virtual void Shuttle(const char* name, long long& value);

      virtual void Shuttle(const char* name, unsigned long long& value);

      virtual void Shuttle(const char* name, float& value);

      virtual void Shuttle(const char* name, double& value);

      virtual void Shuttle(const char* name, std::string& value);

      virtual void Shuttle(const char* name, IO::Buffer& data);

      virtual void StartStructure(const char* name);

      virtual void EndStructure();

      virtual void StartSequence(const char* name);

      virtual void EndSequence();

      using Serializer::Shuttle;

    private:
      struct Implementation;
      boost::scoped_ptr<Implementation> m_imp;
  };
}
}

#endif // AVALON_JSONSERIALIZER_HPP
